(function () {
	var ns = ij.pkg('core').namespaceString;
	
	ij.core.Engine = ij.core.Container.extend({
		init: function (config) {
			this._super(ij.apply({
				classname: ns +'.Engine',
				renderer: {
					classname: 'ij.core.EngineDomRenderer'
				},
				objects: [],
				classes: ['ij-engine'],
				_renderInterval: null,
				renderInterval: 50
			}, config));
			
			var _this = this;
			this._renderInterval = setInterval(function () {
				_this.update();
				_this.render();
			}, this.renderInterval);
			
			return this;
		},
		add: function (object) {
			if (object) {
				if (!(object instanceof ij.core.Viewport)) {
					if (object instanceof ij.core.DisplayObject) {
						this._super(null);
						return this;
					}
					object = new ij.core.Viewport(object);
				}
				this._super(object);
			}
			
			return this;
		}
	});
	
})();